package com.coding.service.impl;

import com.coding.dto.RestBean;
import com.coding.mapper.VideoMapper;
import com.coding.pojo.Videos;
import com.coding.service.VideoService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoServiceImpl implements VideoService {


    @Autowired
    private VideoMapper videoMapper;

    @Override
    public List<Videos> init() {
        return videoMapper.init();
    }

    @Override
    public Long likesInit(Long id) {
        return videoMapper.likesInit(id);
    }

    @Override
    public Long favouriteInit(Long id) {
        return videoMapper.favouriteInit(id);
    }

    @Override
    public Long sharesInit(Long id) {
        return videoMapper.sharesInit(id);
    }

    @Override
    public boolean isFan(Long id,Long followerId) {
        return videoMapper.isFan(id);
    }


    @Override
    public RestBean addVideo(Videos videos) {
        int i = videoMapper.addVideo(videos);
        if (i > 0) {
            return RestBean.success("视频上传成功");
        }else {

            return RestBean.failure(400,"视频上传失败");
        }
    }
}
